//
//  TestDateCell.m
//  ShandsMod
//
//  Created by zh s on 2023/3/23.
//  Copyright © 2023 zh_s. All rights reserved.
//

#import "TestDateCell.h"

@implementation TestDateCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.accessoryType = UITableViewCellAccessoryNone;
        self.backgroundColor = [UIColor clearColor];
        [self createView];
    }
    return self;
}

- (void)createView {
    
    NSArray *titleArr = @[@"使用时长",@"限制宽带算力"];
    NSArray *imageArr = @[@"icon_test_clock",@"icon_test_glass"];
    CGFloat backVWidth = (SCREEN_WIDTH - 52)/2;
    for (NSInteger i = 0; i < 2; i ++) {
        UIView *backV = [[UIView alloc] init];
        [self.contentView addSubview:backV];
        backV.backgroundColor = UIColor.whiteColor;
        backV.frame = CGRectMake(20 + (backVWidth + 12) *i, 0, backVWidth, 65);
        [backV settingRadiusWithShadowOpacity:0.2 withShadowColor:RGB(153, 153, 153) wihtShadowRadius:5 withshadowOffset:CGSizeMake(0, 3) withRadius:12];
        
        UILabel *dateLab = [[UILabel alloc] init];
        [backV addSubview:dateLab];
        dateLab.textColor = MAIN_ACTIVE_COLOR;
        dateLab.font = FONT_NAME(@"DINCond-Bold", 25);
        dateLab.text = @"12:25:36";
        [dateLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(20);
            make.top.mas_equalTo(13);
            make.height.mas_equalTo(25);
        }];
        
        UILabel *hoursLab = [[UILabel alloc] init];
        [backV addSubview:hoursLab];
        hoursLab.textColor = MAIN_ACTIVE_COLOR;
        hoursLab.font = FONT_NAME(FONT_Regular, 10);
        hoursLab.text = @"小时";
        [hoursLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(dateLab.mas_right).mas_offset(4);
            make.bottom.mas_equalTo(dateLab.mas_bottom).mas_offset(0);
            make.height.mas_equalTo(15);
        }];
        
        UILabel *explainLab = [[UILabel alloc] init];
        [backV addSubview:explainLab];
        explainLab.textColor = TEXT_COLOR_153;
        explainLab.font = FONT_NAME(FONT_Regular, 11);
        explainLab.text = titleArr[i];
        [explainLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(dateLab.mas_left).mas_offset(1);
            make.bottom.mas_equalTo(backV.mas_bottom).mas_offset(-7);
            make.height.mas_equalTo(22);
        }];
        
        
        UIImageView *arrowImage = [[UIImageView alloc] init];
        [backV addSubview:arrowImage];
        arrowImage.image = IMAGE_NAME(imageArr[i]);
        
        if (i == 0) {
            [arrowImage mas_makeConstraints:^(MASConstraintMaker *make) {
                make.right.mas_equalTo(backV.mas_right).mas_offset(- 15);
                make.top.mas_equalTo(12);
                make.size.mas_equalTo(CGSizeMake(33, 37));
            }];
            hoursLab.hidden = YES;
        }else {
            [arrowImage mas_makeConstraints:^(MASConstraintMaker *make) {
                make.right.mas_equalTo(backV.mas_right).mas_offset(- 11);
                make.top.mas_equalTo(9);
                make.size.mas_equalTo(CGSizeMake(45, 45));
            }];
            dateLab.text = @"103213";
            hoursLab.hidden = NO;
        }
        
        
        

    }

}


@end
